<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>在此处插入标题</title>
<head>
	<title>换货 - 物流管理系统</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<style media="all" type="text/css">@import "../../style/all.css";</style>
	<script type="text/javascript" src='../../script/common.js'></script>
	<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
	<script type="text/javascript">
	$(function(){
		/* $("#next").click(function(){	
	   var checkID = [];//定义一个空数组
	   alert("aaa");
	   $("input[name='check']:checked").each(function(i){//把所有被选中的复选框的值存入数组
	           checkID[i] =$(this).val();
        });
	   
	   window.location.href="../../customer/getProId/"+checkID;
		}); */
		
		$("#next").click(function(){
			 var productid = $("#productid").val();//定义一个空数组
			  var ordercounts = $("#ordercounts").val()-$("#exitcounts").val();	
			  alert(productid);
			  if(window.confirm("确认修改吗？")){								
			   $.ajax({
				   type:"put", 
				   url:"../../customer/updateProById",
				   contentType:"application/json",					
				   data:JSON.stringify({"productid": productid,"ordercounts": ordercounts}),
				   success:function(result){
					   alert(result);				   
					   window.location.href="../../customer/getProId/"+productid;
					   }
			   });		   
			};
		});	
		
	})
	</script>
</head>
<body style="background: none">
	<div class="top-bar">
				<!--a href="#" class="button">ADD NEW </a-->
				<h1>请选择您需要退回的商品</h1>
				<div class="breadcrumbs"><a href="../../index.html" target="_top">首页</a> / <a href="../index.html">客户服务中心</a></div>
			</div>
			<div class="select-bar"/>
			<div class="table">
				<img src="../../style/img/bg-th-left.gif" width="8" height="7" alt="" class="left" />
				<img src="../../style/img/bg-th-right.gif" width="7" height="7" alt="" class="right" />
				<form action='' method='post' name='formTable'>
				<table class="listing" cellpadding="0" cellspacing="0">
					<tr>
						<th class="first" >商品编号</th>
						<th>商品名称</th>
						<th>数量</th>
						<th>计量单位</th>
						<th>单价</th>
						<th>商品说明</th>
						<th>退货数量</th>
						<th class="last">操作</th>
					</tr>
					<c:forEach items="${pro}" var="pro">
					<tr>
						<td class="first style1">${pro.productid}</td>
						<td>${pro.productname }</td>
						<td><input type="text" value="${pro.ordercounts}" id="ordercounts" style="border: none;background-color: #d8d8d8" readonly="readonly"/></td>
						<td>${pro.unit }</td>
						<td>${pro.originalprice}</td>						
						<td>${pro.productinfo}</td>
						<td><input size="3" value="1" id="exitcounts"></td>
						<td class="last">
						<%-- <a href="getLcustomerById/${pro.productid}"><img src="../style/img/edit-icon.gif" width="16" height="16" alt="修改客户信息" /></a> --%>
							<input type="button" id="next" value="修改"><input type="hidden" id="productid" value="${pro.productid}" />
						</td>
					</tr>	
					</c:forEach>			
				</table>
				<div align="right" style="width:85%;">
					<input type="button" class="button" onclick="back();" value="上一步"/>
					
				</div>
			</div>
</body>
</html>